Function.prototype.extend = function(proto) {
	if (!proto) {
		proto = {};
	}
	var subclass = proto.hasOwnProperty("constructor") ? proto.constructor : proto.constructor = function() {};
	subclass.prototype = Object.create(this.prototype);
	for (var k in proto) {
		if (proto.hasOwnProperty(k)) {
			subclass.prototype[k] = proto[k];
		}
	}
	return subclass;
};
